﻿<html><head><title>eink</title>
<!-------------------------HANGMAN------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
------------------------MADE BY ATOMIX--------------------------------------
----------------------------------------------------------------------------
-----------------------E-INK  SCREEN----------------------------------------
----------------------------------------------------------------------------
-----------You can contact me via e-mail: atomixs@inbox.lv------------------
----------------------------------------------------------------------------
--------------------------------------------------------------------------->
<link rel="stylesheet" type="text/css" href="hangman.css" />
<script type="text/JavaScript" src="library.js"></script>


<script type="text/javascript">
    //////////START//////////////////START///////////////////////START///////////////////START////////////
    //////////////////////////////////////////////////////////////////////////////////
    ///////////////////////THIS IS THE START OF KEYBOARD FUNCTIONS//////////////////
    ///////////PLEASE BECAREFUL IF YOU ARE EDITING SOMETHING////////////////////////
    ////////////OTHERWISE YOU MIGHT BREAK THE WHOLE CODE//////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////
    ////START//////////////////START//////////////////////START//////////////////////START/////////////////

    
    function A() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">A</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">A</g, 'class="style50">A<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nA";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nA";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function B() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">B</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">B</g, 'class="style50">B<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nB";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nB";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function C() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">C</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">C</g, 'class="style50">C<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nC";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nC";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function D() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">D</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">D</g, 'class="style50">D<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nD";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nD";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function E() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">E</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">E</g, 'class="style50">E<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nE";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nE";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function F() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">F</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">F</g, 'class="style50">F<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nF";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nF";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function G() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">G</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">G</g, 'class="style50">G<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nG";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nG";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function H() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">H</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">H</g, 'class="style50">H<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nH";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nH";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function I() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">I</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">I</g, 'class="style50">I<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nI";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nI";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function J() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">J</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">J</g, 'class="style50">J<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nJ";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nJ";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function K() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">K</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">K</g, 'class="style50">K<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nK";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nK";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function L() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">L</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">L</g, 'class="style50">L<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nL";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nL";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function M() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">M</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">M</g, 'class="style50">M<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nM";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nM";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function N() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">N</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">N</g, 'class="style50">N<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nN";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nN";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function O() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">O</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">O</g, 'class="style50">O<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nO";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nO";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function P() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">P</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">P</g, 'class="style50">P<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nP";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nP";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function Q() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">Q</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">Q</g, 'class="style50">Q<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nQ";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nQ";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function R() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">R</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">R</g, 'class="style50">R<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nR";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nR";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function S() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">S</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">S</g, 'class="style50">S<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nS";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nS";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function T() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">T</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">T</g, 'class="style50">T<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nT";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nT";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function U() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">U</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">U</g, 'class="style50">U<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nU";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nU";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function V() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">V</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">V</g, 'class="style50">V<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nV";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nV";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function W() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">W</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">W</g, 'class="style50">W<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nW";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nW";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function X() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">X</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">X</g, 'class="style50">X<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nX";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nX";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function Y() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">Y</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">Y</g, 'class="style50">Y<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nY";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nY";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    function Z() {
        var word = document.getElementById("word").innerHTML;
        var search = /class="style102">Z</g;
        var trueorfalse = search.test(word);
        var currentattempts = document.getElementById("attempts").innerHTML;
        var wrong = currentattempts - 1
        var used = document.getElementById("used").innerHTML;
        var used2 = document.getElementById("used2").innerHTML;
        var length = used.length;

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("attempts").innerHTML = "0";
        }
        else if (document.getElementById("end").innerHTML == "Success!") {
            document.getElementById("attempts").innerHTML = currentattempts;
        }
        else if (trueorfalse == false) {
            document.getElementById("attempts").innerHTML = wrong;
        }
        else {
            currentattempts = currentattempts;
        }
        document.getElementById("word").innerHTML = word.replace(/class="style102">Z</g, 'class="style50">Z<');

        if (length > 22) {
            document.getElementById("used2").innerHTML = used2 + "\nZ";
        }
        else {
            document.getElementById("used").innerHTML = used + "\nZ";
        }

        if (document.getElementById("attempts").innerHTML < 1) {
            document.getElementById("end").innerHTML = "YOU LOSE!";
            document.getElementById("check2").style.display = "block";
            nook.getTouch().loadUrl("javascript:end()");
            reveal();
            writefail();
        }
        success();
        hangman();
    }

    /////END//////////////////END//////////////////END///////////////////END///////////////END///////
    //////////////////////////////////////////////////////////////////////////////////
    ///////////////////////THIS IS THE END OF KEYBOARD FUNCTIONS//////////////////
    ///////////PLEASE BECAREFUL IF YOU ARE EDITING SOMETHING////////////////////////
    ////////////OTHERWISE YOU MIGHT BREAK THE WHOLE CODE//////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////
    /////END/////////////END////////////////////END///////////////////END//////////////END////////////

    
    </script>  


<script type="text/javascript">

    function newgame() {

        hidehangman()
        document.getElementById("m2f").style.display = "none";
        document.getElementById("m1").style.display = "block"
        var i = Math.random();
        i = 1500 * i
        i = Math.floor(i);
        document.getElementById("word").innerHTML = word[i];
        var wordd = document.getElementById("word").innerHTML;
        document.getElementById("dlength").innerHTML = wordd;
        document.getElementById("used").innerHTML = ""
        document.getElementById("used2").innerHTML = ""
        document.getElementById("attempts").innerHTML = "6"
        document.getElementById("end").style.visibility = "hidden"
        document.getElementById("end").innerHTML = ""
        document.getElementById("check2").style.display = "none";
        document.getElementById("check").style.display = "none";
        
        var word2 = document.getElementById('word'),
        letters = word2.innerHTML.split(''),
        spanified="";
        for (var k = 0, j = letters.length; k < j; k++) {
            spanified += '<span class="style102">' + letters[k] + '</span>' + '<span class="style49"> </span>';
        } 
        word2.innerHTML = spanified;


        /* document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/A/g, '<span class="style106">A</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/B/g, '<span class="style106">B</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/C/g, '<span class="style106">C</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/D/g, '<span class="style106">D</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/E/g, '<span class="style106">E</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/F/g, '<span class="style106">F</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/G/g, '<span class="style106">G</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/H/g, '<span class="style106">H</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/I/g, '<span class="style106">I</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/J/g, '<span class="style106">J</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/K/g, '<span class="style106">K</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/L/g, '<span class="style106">L</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/M/g, '<span class="style106">M</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/N/g, '<span class="style106">N</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/O/g, '<span class="style106">O</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/P/g, '<span class="style106">P</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/Q/g, '<span class="style106">Q</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/R/g, '<span class="style106">R</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/S/g, '<span class="style106">S</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/T/g, '<span class="style106">T</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/U/g, '<span class="style106">U</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/V/g, '<span class="style106">V</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/W/g, '<span class="style106">W</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/X/g, '<span class="style106">X</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/Y/g, '<span class="style106">Y</span><span class="style107"> </span>');
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/Z/g, '<span class="style106">Z</span><span class="style107"> </span>'); */
 
    
    }


    function reveal() {
        document.getElementById("word").innerHTML = document.getElementById("word").innerHTML.replace(/"style102"/g, '"style200"');
    }

    function log() {
        clearoptions();
        document.getElementById("log").className = "style255";


    }

    function howto() {
        clearoptions();
        document.getElementById("howto").className = "style274";

    }

    function resetmsg() {
        clearoptions();
        document.getElementById("reset").className = "style297";

    }

    function reset() {
        nook.writeData("fail", 0);
        nook.writeData("success", 0);
        clearoptions();
        readhighscores();
    }

    function cancel() {
        clearoptions();
        readhighscores()
    }


    function clearoptions() {
        if (document.getElementById("options").className == "style255") {
            document.getElementById("options").className = "style201"
        }
        if (document.getElementById("howto").className == "style274") {
            document.getElementById("howto").className = "style274a"
        }
        if (document.getElementById("log").className == "style255") {
            document.getElementById("log").className = "style201"
        }
        if (document.getElementById("hg").className == "stylehg") {
            document.getElementById("hg").className = "stylehg2"
            document.getElementById("hgscr").className = "stylehgscr2"
        }
        if (document.getElementById("reset").className == "style297") {
            document.getElementById("reset").className = "style297a"
        }

    }

    function string() {
        var word = document.getElementById("word").innerHTML;
        var wlength = word.length;
        document.getElementById("wordbox").innerHTML = ("string length: " + wlength);
    }

    function string2() {
        var duplicate = document.getElementById("dlength").innerHTML;
        var dlength = duplicate.length
        document.getElementById("dbox").innerHTML = ("duplicate length: " + dlength);
    }

    function success() {
        var word = document.getElementById("word").innerHTML;
        var wlength = word.length; //30   --> 29
        var duplicate = document.getElementById("dlength").innerHTML;
        var dlength = duplicate.length; //1  --> 1
        var complete = (dlength*60);  // 30 - 1 = 29
        if (wlength == complete) {
            document.getElementById("m4").style.display = "none"
            document.getElementById("check").style.display = "block";
            document.getElementById("end").innerHTML = "SUCCESS!";
            nook.getTouch().loadUrl("javascript:end2()");
            writesuccess();
            document.getElementById("m2f").style.display = "block"
            setTimeout("hhh()", 1);
 
        }
    }

    function hhh() {
        document.getElementById("m6").style.display = "none"

    }

    function options() {
        document.getElementById("word").style.visibility = "hidden";
        document.getElementById("result").style.visibility = "hidden";
        document.getElementById("attempts").style.visibility = "hidden";
        document.getElementById("used").style.visibility = "hidden";
        document.getElementById("used2").style.visibility = "hidden";
        document.getElementById("usedtext").style.visibility = "hidden";
        document.getElementById("options").className = "style255"
        document.getElementById("m1").style.display = "none"
        document.getElementById("m2").style.display = "none"
        document.getElementById("m2a").style.display = "none"
        document.getElementById("m2b").style.display = "none"
        document.getElementById("m2c").style.display = "none"
        document.getElementById("m2d").style.display = "none"
        document.getElementById("m2e").style.display = "none"
        document.getElementById("m3").style.display = "none"
        document.getElementById("m4").style.display = "none"
        document.getElementById("m5").style.display = "none"
        document.getElementById("m6").style.display = "none"
        document.getElementById("m7").style.display = "none"
        
    }

    function optionshide() {
        document.getElementById("word").style.visibility = "visible";
        document.getElementById("result").style.visibility = "visible";
        document.getElementById("attempts").style.visibility = "visible";
        document.getElementById("used").style.visibility = "visible";
        document.getElementById("used2").style.visibility = "visible";
        document.getElementById("usedtext").style.visibility = "visible";
        document.getElementById("hg").className = "stylehg2"
        document.getElementById("hgscr").className = "stylehgscr2"
        document.getElementById("options").className = "style201"
        document.getElementById("log").className = "style201"
        document.getElementById("howto").className = "style274a"
        document.getElementById("m1").style.display = "block"
        if (document.getElementById("dumpm2").innerHTML == "V") {
        document.getElementById("m2").style.display = "block"
        }
        if (document.getElementById("dumpm2a").innerHTML == "V") {
        document.getElementById("m2a").style.display = "block"
        }
        if (document.getElementById("dumpm2b").innerHTML == "V") {
        document.getElementById("m2b").style.display = "block"
        }
        if (document.getElementById("dumpm2c").innerHTML == "V") {
        document.getElementById("m2c").style.display = "block"
        }
        if (document.getElementById("dumpm2d").innerHTML == "V") {
        document.getElementById("m2d").style.display = "block"
        }
        if (document.getElementById("dumpm2e").innerHTML == "V") {
        document.getElementById("m2e").style.display = "block"
        }
        if (document.getElementById("dumpm3").innerHTML == "V") {
        document.getElementById("m3").style.display = "block"
        }
        if (document.getElementById("dumpm4").innerHTML == "V") {
        document.getElementById("m4").style.display = "block"
        }
        if (document.getElementById("dumpm5").innerHTML == "V") {
        document.getElementById("m5").style.display = "block"
        }
        if (document.getElementById("dumpm6").innerHTML == "V") {
        document.getElementById("m6").style.display = "block"
        }
        if (document.getElementById("dumpm7").innerHTML == "V") {
        document.getElementById("m7").style.display = "block"
        }

    }
  

    function hidehangman() {
    document.getElementById("m2").style.display = "none"
    document.getElementById("m2a").style.display = "none"
    document.getElementById("m2b").style.display = "none"
    document.getElementById("m2c").style.display = "none"
    document.getElementById("m2d").style.display = "none"
    document.getElementById("m2e").style.display = "none"
    document.getElementById("m3").style.display = "none"
    document.getElementById("m4").style.display = "none"
    document.getElementById("m5").style.display = "none"
    document.getElementById("m6").style.display = "none"
    document.getElementById("m7").style.display = "none"
    document.getElementById("dumpm2").innerHTML = "H"
    document.getElementById("dumpm2a").innerHTML = "H"
    document.getElementById("dumpm2b").innerHTML = "H"
    document.getElementById("dumpm2c").innerHTML = "H"
    document.getElementById("dumpm2d").innerHTML = "H"
    document.getElementById("dumpm2e").innerHTML = "H"
    document.getElementById("dumpm3").innerHTML = "H"
    document.getElementById("dumpm4").innerHTML = "H"
    document.getElementById("dumpm5").innerHTML = "H"
    document.getElementById("dumpm6").innerHTML = "H"
    document.getElementById("dumpm7").innerHTML = "H"
 
    }

    function hangman() {
        

        if (document.getElementById("attempts").innerHTML == 5) {
            document.getElementById("m2").style.display = "block"
            document.getElementById("dumpm2").innerHTML = "V"
        }
        if (document.getElementById("attempts").innerHTML == 4) {
            document.getElementById("m3").style.display = "block"
            document.getElementById("m2a").style.display = "block"
            document.getElementById("m2").style.display = "none"
            document.getElementById("dumpm2a").innerHTML = "V"
            document.getElementById("dumpm3").innerHTML = "V"
        }
        if (document.getElementById("attempts").innerHTML == 3) {
            document.getElementById("m4").style.display = "block"
            document.getElementById("m2a").style.display = "none"
            document.getElementById("m2b").style.display = "block"
            document.getElementById("dumpm2b").innerHTML = "V"
            document.getElementById("dumpm4").innerHTML = "V"
        }
        if (document.getElementById("attempts").innerHTML == 2) {
            document.getElementById("m5").style.display = "block"
            document.getElementById("m2b").style.display = "none"
            document.getElementById("m2c").style.display = "block"
            document.getElementById("dumpm2c").innerHTML = "V"
            document.getElementById("dumpm5").innerHTML = "V"
        }
        if (document.getElementById("attempts").innerHTML == 1) {
            document.getElementById("m6").style.display = "block"
            document.getElementById("m2c").style.display = "none"
            document.getElementById("m2d").style.display = "block"
            document.getElementById("dumpm2d").innerHTML = "V"
            document.getElementById("dumpm6").innerHTML = "V"
        }
        if (document.getElementById("attempts").innerHTML == 0) {
            document.getElementById("m7").style.display = "block"
            document.getElementById("m2d").style.display = "none"
            document.getElementById("m2e").style.display = "block"
            document.getElementById("dumpm2e").innerHTML = "V"
            document.getElementById("dumpm7").innerHTML = "V"
        }
    }


    function writefail() {
        var read = nook.readData("fail");
        var parsed = parseInt(read) + 1
        nook.writeData("fail", parsed);
        if (nook.readData("fail") == "NaN") {
            nook.writeData("fail", 1);
        }
    }

    function writesuccess() {      
        var read2 = nook.readData("success");
        var parsed2 = parseInt(read2) + 1
        nook.writeData("success", parsed2);
        if (nook.readData("success") == "NaN") {
            nook.writeData("success", 1);
        }    
    }

    function readhighscores() {
        clearoptions();
        if (nook.readData("success") == "") {
            nook.writeData("success", 0);
        }
        if (nook.readData("fail") == "") {
            nook.writeData("fail", 0);
        }
        document.getElementById("hgscr").innerHTML = "You have succeeded " + nook.readData("success") + " times" + "<br>" + "<br>" + "You have failed " + nook.readData("fail") + " times";
        document.getElementById("hg").className = "stylehg"
        document.getElementById("hgscr").className = "stylehgscr"
    }
    


</script>



    <style type="text/css">
        #word
        {
            width: 595px;
            height: 71px;
            text-align: center;
            top: 8px;
            left: 1px;
            position: absolute;
            color: #000000;
            font-size: 45pt;
            background-color: #FFFFFF;
        }
        .style2
        {
            width: 355px;
            height: 68px;
            position: absolute;
            left: 14px;
            top: 129px;
            font-size: xx-large;
            right: 666px;
        }
        
        #used
        {
            height: 404px;
            width: 31px;
            top: 240px;
            left: 52px;
            position: absolute;
            font-size: 25pt;
        }
        #usedtext
        {
            top: 219px;
            left: 13px;
            position: absolute;
            height: 25px;
            width: 130px;
        }
        #used2
        {
            top: 239px;
            left: 98px;
            position: absolute;
            height: 403px;
            width: 29px;
            font-size: 25pt;
        }
        </style>
        <style type="text/css">
                
            #res
            {
                top: 238px;
                left: 198px;
                position: absolute;
                height: 77px;
                width: 231px;
            }
        
            #attempts
            {
                top: 129px;
                left: 235px;
                position: absolute;
                height: 64px;
                width: 87px;
            }
            .style3
            {
                font-size: xx-large;
            }
        
        </style>
        <style type="text/css">
            
            #end
            {
                height: 97px;
                width: 454px;
                top: 602px;
                left: 160px;
                position: absolute;
                text-align: center;
                margin-right: 4px;
                visibility: hidden;
            }
            .style100
            {
                font-family: "Courier New";
                font-size: 60pt;
                color: #FFFFFF;
                background-color: #000000;
            }
                       
             #stringbox
            {
                top: 250px;
                left: 176px;
                position: absolute;
                height: 104px;
                width: 285px;
            }
            #wordbox
            {
                top: 23px;
                left: 27px;
                position: absolute;
                height: 11px;
                width: 84px;
            }
            
            #success
            {
                top: 365px;
                left: 195px;
                position: absolute;
                height: 50px;
                width: 269px;
                font-size: xx-large;
            }
            #dlength
            {
                top: 34px;
                left: 93px;
                position: absolute;
                height: 0px;
                width: 8px;
                color: #FFFFFF;
                z-index: -1;
                background-color: #FFFFFF;
                visibility:hidden;
            }
            #dbox
            {
                top: 56px;
                left: 26px;
                position: absolute;
                height: 19px;
                width: 82px;
            }
            #duplicate
            {
                width: 595px;
                height: 71px;
                text-align: center;
                top: 4px;
                left: 9px;
                position: absolute;
                color: #000000;
                text-transform: none;
                font-size: 45pt;
                letter-spacing: 21px;
                vertical-align: text-bottom;
            }
            
                
                
                
            
            #check4
            {
                top: 474px;
                left: 349px;
                position: absolute;
                height: 267px;
                width: 234px;
            }
            #check
            {
                top: 128px;
                left: 435px;
                position: absolute;
                height: 119px;
                width: 118px;
            }
            #check2
            {
                top: 129px;
                left: 445px;
                position: absolute;
                height: 116px;
                width: 98px;
            }
           
            
           
            .style203
            {
                text-align: center;
                font-size: 40pt;
            }
            .style256
            {
                font-size: 17pt;
            }
            .style257
            {
                text-decoration: underline;
            }
            .style260
            {
                width: 33px;
                text-align: center;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 44px;
                font-family: "Courier New", Courier, monospace;
            }
            .style265
            {
                width: 99px;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 22px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style266
            {
                width: 387px;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 22px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style267
            {
                width: 114px;
                text-align: left;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 22px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
                        
            .style271
            {
                font-weight: normal;
                font-size: 17pt;
            }
            .style273
            {
                font-family: "Courier New", Courier, monospace;
            }
            #hangman
            {
                top: 331px;
                left: 323px;
                height: 312px;
                width: 355px;
            }
            #m1
            {
                top: 2449px;
                left: 15px;
                position: absolute;
                height: 473px;
                width: 381px;
            }
            .style278
            {
                width: 99px;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 30px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style279
            {
                width: 387px;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 30px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style280
            {
                width: 114px;
                text-align: left;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 30px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style281
            {
                width: 99px;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 28px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style282
            {
                width: 387px;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 28px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style283
            {
                width: 114px;
                text-align: left;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 28px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style284
            {
                width: 99px;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 25px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style285
            {
                width: 387px;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 25px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style286
            {
                width: 114px;
                text-align: left;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 25px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style287
            {
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 55px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style288
            {
                width: 387px;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 55px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style289
            {
                width: 114px;
                text-align: left;
                border-style: solid;
                border-width: 1px;
                padding: 1px 4px;
                height: 55px;
                font-size: 18pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style290
            {
                font-size: 16pt;
            }
            .style291
            {
                font-size: x-large;
            }
            .style292
            {
                text-align: left;
                font-size: xx-large;
            }
            .style293
            {
                font-size: 19pt;
            }
            
            .style294
            {
                font-size: 50pt;
                font-family: "Courier New", Courier, monospace;
            }
            .style295
            {
                font-family: "Courier New", Courier, monospace;
                font-size: 35pt;
            }
            .style296
            {
                font-size: 42pt;
                font-family: "Courier New", Courier, monospace;
                text-align: center;
            }
            
            </style>



</head> 
<body style="width: 6px; height: 7px; margin-left: 15px;" 
    onload="newgame()">
   

    <h1 id="word"></h1>

    <h1 id="dlength"></h1>
    <h2 id="result" class="style2">Attempts left:</h2>
    <h2 id="attempts" class="style3">6</h2>
    <h3 id="used"></h3>
    <h3 id="used2"></h3>
    <h3 id="usedtext">Used letters:</h3>
    <h2 id="end" class="style100"></h2>
    <h3 id="wordbox"></h3>
    <h3 id="dbox"></h3>
    <h3 id="dumpm2" class="styledump">H</h3>
    <h3 id="dumpm2a" class="styledump">H</h3>
    <h3 id="dumpm2b" class="styledump">H</h3>
    <h3 id="dumpm2c" class="styledump">H</h3>
    <h3 id="dumpm2d" class="styledump">H</h3>
    <h3 id="dumpm2e" class="styledump">H</h3>
    <h3 id="dumpm3" class="styledump">H</h3>
    <h3 id="dumpm4" class="styledump">H</h3>
    <h3 id="dumpm5" class="styledump">H</h3>
    <h3 id="dumpm6" class="styledump">H</h3>
    <h3 id="dumpm7" class="styledump">H</h3>
    <h3 id="highscores" class="styledump2"></h3>
    <h3 id="highscores2" class="styledump2"></h3>
    <h3 id="dumphigh" class="styledump">H</h3>
    <h4 id="version" class="style103">&nbsp; <span class="style104">Hangman v.0.5.4</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <span class="style105">made by Atomix</span></h4>


       <img src="images/ch2.png" alt="checkmark" id="check" style="display:none"/>
       <img src="images/chh4.png" alt="checkmark" id="check2" style="display:none"/>
       <img src="images/m1.png" alt="hangman" id="m1" 
        style="display:block; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 693px;"/>
       <img src="images/m2.png" alt="hangman" id="m2" style="display:none; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 482px;"/>
       <img src="images/m2a.png" alt="hangman" id="m2a" style="display:none; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 482px;"/>
       <img src="images/m2b.png" alt="hangman" id="m2b" style="display:none; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 482px;"/>
       <img src="images/m2c.png" alt="hangman" id="m2c" style="display:none; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 482px;"/>
       <img src="images/m2d.png" alt="hangman" id="m2d" style="display:none; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 482px;"/>
       <img src="images/m2e.png" alt="hangman" id="m2e" style="display:none; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 482px;"/>
       <img src="images/m2f.png" alt="hangman" id="m2f" style="display:none; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 482px;"/>
       <img src="images/m3.png" alt="hangman" id="m3" style="display:none; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 482px;"/>
       <img src="images/m4.png" alt="hangman" id="m4" style="display:none; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 482px;"/>
       <img src="images/m5.png" alt="hangman" id="m5" style="display:none; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 482px;"/>
       <img src="images/m6.png" alt="hangman" id="m6" style="display:none; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 482px;"/>
       <img src="images/m7.png" alt="hangman" id="m7" style="display:none; top: 252px; left: 170px; position: absolute; height: 473px; width: 381px; right: 482px;"/>
  

        
        
     

    <table class="style201" id="options">
        <tr>
            <td class="style202" style="text-align: center">
                HANGMAN</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style203">
                version: 0.5.4</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <span class="style104"><br /> </span><span class="style291">Please use&nbsp; nookMarket to check&nbsp; for the latest 
                updates. </span><br class="style104" />
                </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style104">
                Please send me your suggestions - I really want to know, what YOU want to see 
                implemented in this application, I will <span class="style257">read and answer</span> every e-mail regarding 
                suggestions, critics, comments and questions. So, please don&#39;t be lazy and tell me what you 
                wish to be improved!  You may aswell post your messages on nookdevs discussion page.</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style292">
                <span class="style293">Official website:</span> <font size="5">http://nookdevs.com/Hangman</font></td>
        </tr>
        <tr>
            <td style="text-align: center" class="style256">
                Programmed and designed by Atomix</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td style="text-align: center; " class="style290">
                contact me: atomixs@inbox.lv</td>
            <td>
                &nbsp;</td>
        </tr>
    </table>

    <!------------TABLE FOR CHANGELOG----------------
    -------------------------------------------------
    ------------------------------------------------>
    <table class="style201" id="log">
        <tr>
            <td class="style260" style="font-size: 35pt;" colspan="3">
                ChangeLog</td>
        </tr>
        <tr>
            <td class="style265">
                Version</td>
            <td class="style266">
                Description</td>
            <td class="style267">
                Release date</td>
        </tr>
        <tr>
            <td class="style278">
                0.1.0</td>
            <td class="style279">
                initial release&nbsp;</td>
            <td class="style280">
                22.08.10</td>
        </tr>
        <tr>
            <td class="style284">
                0.2.1</td>
            <td class="style285">
                Added gallows</td>
            <td class="style286">
                23.08.10</td>
        </tr>
        <tr>
            <td class="style281">
                0.3.2</td>
            <td class="style282">
                Added highscores</td>
            <td class="style283">
                25.08.10</td>
        </tr>
        <tr>
            <td class="style287">
                0.4.2</td>
            <td class="style288">
                Vocabulary update</td>
            <td class="style289">
                26.08.10</td>
        </tr>
        <tr>
            <td class="style287">
                0.5.3</td>
            <td class="style288">
                Added reset feature and happy face</td>
            <td class="style289">
                27.08.10</td>
        </tr>
        <tr>
            <td class="style287">
                0.5.4</td>
            <td class="style288">
                Fixed alot of stuff</td>
            <td class="style289">
                27.08.10</td>
        </tr>
        <tr>
            <td class="style287" colspan="3">
                <em>Currently the vocabulary contains: 1500 words</em></td>
        </tr>
        <tr>
            <td class="style273" style="font-size: 16pt;" colspan="3">
                <strong><span class="style273">Please use nookMarket to update Hangman.</span><br class="style273" />
                <span class="style273">(You need the latest nookMarket installed - v.0.3 or above)</span></strong></td>
        </tr>
        </table>

        <h1 id="howto" class="style274a">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            Instructions<br />
            <span class="style271"><span class="style273">Hangman is a word guessing game,</span><br 
                class="style273" />
            <span class="style273">where you are given 6 chances to reveal a word that is hidden behind a black 
            unit.</span><br class="style273" />
            <br class="style273" />
            <span class="style273">You guess by clicking on letters, if the word contains a letter you pressed, 
            then the all appropriate places containing the letter are revealed to you and 
            the count of attempts do NOT lower.
            </span>
            <br class="style273" />
            <span class="style273">However, if you press a letter that the word does not contain, then given 
            attempts lower by 1 chance. If you reach zero - you lose.</span><br 
                class="style273" />
            <br class="style273" />
            <span class="style273">Please note: ALL of the words that this game contains have been chosen and 
            formatted one by one. ALL of them have been taken from the commonly used english 
            word list, thus the game&#39;s difficulty is balanced making it enjoyable.</span><br 
                class="style273" />
            <span class="style273">Hope you like it !&nbsp; </span> </span>
            </h1>

            <h1 id="hg" class="stylehg2">Highscores</h1>
            <h1 id="hgscr" class="stylehgscr2"></h1>
            <h1 id="reset" class="style297a"><span class="style296">
                <br />
                Are you sure you want to reset 
                <br />
                your highscores?</span><span class="style294">
                </span>
                <br class="style273" />
                <br />
                <br />
                <br />
                <br class="style273" />
                <span class="style295">Your highscores will be reset to 0 (zero) and you will NOT be able to undo this 
                action.</span></h1>


            </body>
</html>

